<!-- 变电检修工区工作任务单 gzrwd.jsp -->
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<html>
	<head>
		<script type="text/javascript" src="<%=contextPath%>/js/jquery.autogrow.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		
		<script type="text/javascript" language="javascript">  
		
		$(document).ready (function() {
			//$('textarea.indispensable_left').autogrow();	
			$('textarea').autogrow();		
		});
		
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
						{
				            text: '添加工作任务',
				            icon:"<%=contextPath%>/images/pass.gif",
				            handler:dbrw,
				            hidden:<%=session.getAttribute("btn_insertgzrwd_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:toCheck,
				            hidden:<%=(session.getAttribute("btn_savegzrwd_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN"))) ? false:true%>
				        },'-',
				        
				        {
				            text: '归档',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:toCheckHistory,
				            hidden:<%=( "1".equals(session.getAttribute("SESSION_ISADMIN"))) ? false:true%>
				        },'-',
				        {
				            text: '起草工作票',
				            icon:"<%=contextPath%>/images/pass.gif",
				            handler:wwcdbrw,
				            hidden:<%= ("1".equals(session.getAttribute("SESSION_ISADMIN"))) ? false:true%>
				        },'-',
				        {
				            text: '作业指导书',
				            icon:"<%=contextPath%>/images/pass.gif",
				            handler:wwcdbrw,
				            hidden:<%= ("1".equals(session.getAttribute("SESSION_ISADMIN"))) ? false:true%>
				        },'-',
				        {
				            text: '起草风险辨析',
				            icon:"<%=contextPath%>/images/pass.gif",
				            handler:wwcdbrw,
				            hidden:<%= ("1".equals(session.getAttribute("SESSION_ISADMIN"))) ? false:true%>
				        },'-',
				        {
				            text: '班组作业控制卡',
				            icon:"<%=contextPath%>/images/print.png",
				            handler:function(){
				            	print();
				            },
				            hidden:<%=session.getAttribute("btn_print_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '二次安全措施票',
				            icon:"<%=contextPath%>/images/print.png",
				            handler:function(){
				            	print();
				            },
				            hidden:<%=session.getAttribute("btn_print_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '打印',
				            icon:"<%=contextPath%>/images/print.png",
				            handler:function(){
				            	print();
				            },
				            hidden:<%=session.getAttribute("btn_print_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	back();
				            }
				        }
			    	]
			    });
			});
		
			function toCheck(){

			  	if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
  				comt();
		    }
		    function toCheckHistory(){

			  	if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
  				comthistory();
		    }
		    // 待办任务列表
		    function dbrw() {
		    
		    	if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
		    
		    	var url = "<%=contextPath%>/gzrwd!getDbList.do";//"<%=contextPath%>/gzrwDbList!getList.do";
		    	var win = openSUB(url,1,1000,550,150,30);
		    }
// 未完成办任务列表
		    function wwcdbrw() {
		    
		    	if(!Validator.Validate(frmM,2)){
				  return false;
			  	}
		    
		    	var url = "<%=contextPath%>/gzrwDbList!getList.do?countPerPage=25";//"<%=contextPath%>/gzrwDbList!getList.do";
		    	var win = openSUB(url,1,1000,550,150,30);
		    }
		 </script>  
	</head>
	<body>
		<div id = "tbar" style="position:absolute;display:block left:0px; top:0px; width:100%; height:35px; z-index:1;"></div>
	<br>
	<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
	
		<!-- 信息提示 -->
		<div id="result" align="center"><font color="red">${info }</font></div>
		<table width="100%" height="30">
			<tr>
				<td colspan="4" align="center">
					变电检修工区工作任务单
				</td>
			</tr>
		</table>
		
		<form id="frmM" name="frmM" method="POST" action="<%=contextPath%>/user!save.do">
			<table width="100%" height="30">
				<tr>
					<td colspan="4" align="right">
						<font color="red">*</font>&nbsp;编号：${entity.bh}
					</td>
				</tr>
			</table>
			<input type="hidden" name="searchBean.con15" value="${entity.id}"/>
			<input type="hidden" name="ids" id="ids"/>
			<input type="hidden" name="fxgznr" id="fxgznr"/>
			<input type="hidden" name="idsalready" id="idsalready"/>
			<input type="hidden" id="hiddenids" name="hiddenids" value="${hiddenids}"/>
			<s:hidden name="entity.id" />
			<s:hidden name="entity.ouid"/>
			<s:hidden name="entity.bh"/>
			<s:hidden name="entity.zbzname"/>
			<s:hidden name="entity.zby"/>
			<s:hidden name ="entity.dwry"/>	
			<s:hidden name ="entity.czr"/>	
			<s:hidden name ="entity.gzr"/>	
			<s:hidden name="entity.bdz"/>
			<s:hidden name="entity.state"/>
			<s:hidden name="bdz" />
			<s:hidden name="entity.planid"/>
			<table width="100%" id="infotab">
				<tr>
					<th width="16%" nowrap>
						<font color="red">*</font>&nbsp;日期：
					</th>
					<td >
						<input type="text" readonly="true" name="entity.rq" datatype="Require" value='<fmt:formatDate value="${entity.rq}" pattern="yyyy-MM-dd HH:mm"/>' msg="日期必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.rq')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th width="16%" nowrap>
						<font color="red">*</font>&nbsp;班组：
					</th>
					<td >
						<s:select list="bzList" name="entity.bgzr" width="300" listKey="id" listValue="organName"/>
					</td>
				</tr>
				<tr>
					<th width="16%" nowrap>
						<font color="red">*</font>&nbsp;负责人：
					</th>
					<td >
						<s:select list="zbzList" name="entity.zbz" width="300" listKey="userid" listValue="username"/>

					</td>
					<th width="6%" nowrap>
						<font color="red">*</font>&nbsp;任务接收人：
					</th>
					<td >
						<input type="text"  readonly="true" style="width:90%" name="entity.zbyname" value="${entity.zbyname}" msg="任务接收人必须输入。">
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.zby','entity.zbyname','bdz','entity.zbz')" />
					</td>
				</tr>
				<tr>
					<th width="120" >
						<font color="red">*</font>&nbsp;变电站：
					</th>
					<td nowrap>
							<!--<s:select list="bdzList" name="entity.bdzname" width="300" listKey="id" listValue="bdzname"/>-->
							<input type="text"  readonly="true" style="width:90%" name="entity.bdzname" value="${entity.bdzname}" msg="任务接收人必须输入。">
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getBdzjx('entity.bdz','entity.bdzname','entity.ouid')" />
					
					</td>
					<th width="120" nowrap>
						
					</th>
					<td>
						
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
					开始时间：
					</th>
					<td>
						<input type="text"  onclick="WdatePicker({el:$dp.$('entity.czkssj')})" name="entity.czkssj" readonly="true" value='<fmt:formatDate value="${entity.czkssj}" pattern="yyyy-MM-dd HH:mm"/>' msg="开始时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.czkssj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<th width="120" nowrap>
						结束时间：
					</th>
					<td>
						<input type="text"  onclick="WdatePicker({el:$dp.$('entity.czjssj')})" name="entity.czjssj" readonly="true" value='<fmt:formatDate value="${entity.czjssj}" pattern="yyyy-MM-dd HH:mm"/>' msg="结束时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.czjssj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<tr>
					<th width="120" nowrap>
						验收人：
					</th>
					<td>
						<input type="text" style="width:50%" readonly="true" name="entity.czrname" value="${entity.czrname}" msg="验收人必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.czr','entity.czrname','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						到位人员：
					</th>
					<td>
						
						<input type="text" style="width:50%" readonly="true" name="entity.dwryname" value="${entity.dwryname}" msg="到位人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.dwry','entity.dwryname','entity.bdz')" />
						
					</td>
				</tr>
				
			</table>
			<!--  <hr>
			<table width="100%" id="listtab">
				<tr>
					<th width="30">取消</>
				
					<th width="150">任务来源</th>
					<th width="60">变电站</th>
					<th colspan="2" >工作任务</th>
					<th width="60">是否完成</th>
				</tr>
				<tbody id="TGzrwdRw">
				<c:forEach items="${GZRWDLIST}" var="detail" varStatus="status">
					<tr id='gzrw${status.index}'>
						
						<td width="30"><img style="${(btn_delgzrwd_display==null &&  SESSION_ISADMIN != '1')?"display:none":"display:"}" onclick="javascript:deleteDetail('${detail.id}','TGzrwdRw','gzrw${status.index}')" style='cursor:pointer' src="<%=contextPath%>/images/delete.gif" alt="取消任务"></td>
						<td width="150">
							<c:choose>
								<c:when test="${detail.model == '0'}">巡视情况  </c:when>
								<c:when test="${detail.model == '1'}">巡视情况  </c:when>
								<c:when test="${detail.model == '2'}">工作预告</c:when>
								<c:when test="${detail.model == '3'}">工作票许可、 终结</c:when>
								<c:when test="${detail.model == '4'}">工作票终结</c:when>
								<c:when test="${detail.model == '5'}">倒闸操作预告</c:when>
								<c:when test="${detail.model == '6'}">倒闸操作</c:when>
								<c:when test="${detail.model == '7'}">高频通道测试</c:when>
								<c:when test="${detail.model == '8'}">异常故障</c:when>
								<c:when test="${detail.model == '9'}">设备缺陷</c:when>
								<c:when test="${detail.model == 'A'}">设备试验轮换情况</c:when>
								<c:when test="${detail.model == 'B'}">钥匙使用</c:when>
								<c:when test="${detail.model == 'C'}">上级工作安排</c:when>
								<c:when test="${detail.model == 'D'}">周安全活动情况</c:when>
							</c:choose>
						</td>
						<td width="60"><c:out value="${detail.bdzname}"/></td>
						<td colspan="2" align="left" style="text-align:left"><c:out value="${detail.rwnr}"/></td>
						<td width="50">
							<select name="sfwc" onchange="updateRw(this, '${detail.czid}','${detail.czurl}','${detail.id}')">
							<c:choose>
								<c:when test="${detail.sfwc == '' || detail.sfwc == null}">
									<option value="" selected></option>
									<option value="0">否</option>
									<option value="1">是</option>
								</c:when>
								<c:when test="${detail.sfwc == '0'}">
									<option value="" ></option>
									<option value="0" selected>否</option>
									<option value="1">是</option>
								</c:when>
								<c:when test="${detail.sfwc == '1'}">
									<option value="" ></option>
									<option value="0">否</option>
									<option value="1" selected>是</option>
								</c:when>
							</c:choose>
							</select>
					</tr>
				</c:forEach>
				</tbody>
				<c:if test="${GZRWDLIST == null || fn:length(GZRWDLIST) == 0 }">
					<tr>
						<td colspan="8" style="text-align: center">
							没有添加工作任务
						</td>
					</tr>
				</c:if>
			</table>
			<hr>-->

			<!--  <table width="100%" id="listtab">
				<tr>
					<th width="30">删除</th>
					<th>工作任务风险点告知</th>
					<th width="30">修改</th>
				</tr>
				<tbody id="TGzrwdFxgz">
				<c:forEach items="${FXGZLIST}" var="detail" varStatus="status">
					<tr id='fxgz${status.index}'>
						<td style="display:none">${detail.fxgzdicid}</td>
						<td width="30"><img style="${(btn_delfxgz_display==null && SESSION_ISADMIN != '1' )?"display:none":"display:"}" alt="删除风险点告知" onclick="javascript:deleteDetail('${detail.id}','TGzrwdFxgz','fxgz${status.index}')" style='cursor:pointer' src="<%=contextPath%>/images/delete.gif"></td>
						<td align="left" style="text-align:left">
						<textarea style="width:99%; height: 20px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0"  max="2000" name="fxgznr${status.index}" msg="风险点告知必须输入，最多输入1000个汉字。"/>${detail.fxgznr}</textarea>
						</td>
						<td width="30"><img style="${(btn_delfxgz_display==null && SESSION_ISADMIN != '1' )?"display:none":"display:"}" alt="修改风险点告知" onclick="javascript:updateFxgz('${detail.id}','fxgznr${status.index}')" style='cursor:pointer' src="<%=contextPath%>/images/save.gif"></td>
						
						</tr>
				</c:forEach>
				</tbody>
				<c:if test="${FXGZLIST == null || fn:length(FXGZLIST) == 0 }">
					<tr>
						<td colspan="8" style="text-align: center">
							没有添加任务风险点告知
						</td>
					</tr>
				</c:if>
			</table>-->
				<hr>
		<div id="main-div" scrolling="no" style= "overflow:hidden" >
			<center><iframe id= "gzrwd" src="gzrwd!getCzrw.do" scrolling="yes" frameborder="no" width="99%" height="200" ></iframe></center>
		</div>
			<hr>
			<table width="100%" id="infotab">
			<tr>
					<th width="16%" nowrap>
						工作范围： 
					</th>
					<td nowrap colspan="3" >
						<textarea style="width:99%; height: 50px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0"  max="2000" name="entity.ycclqk" msg="工作范围必须输入，最多输入1000个汉字。"/>${entity.ycclqk}</textarea>
					</td>
				</tr>
				<tr>
					<th width="16%" nowrap>
						工作任务未完成原因及处理情况： 
					</th>
					<td nowrap colspan="3" >
						<textarea style="width:99%; height: 50px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0"  max="2000" name="entity.fxgz" msg="工作任务未完成原因及处理情况必须输入，最多输入1000个汉字。"/>${entity.fxgz}</textarea>
					</td>
				</tr>
				
	<tr>
                  <th align="left" >工作票号：</th>
				  <td ><s:textfield   name="entity.gzpno" maxlength="50" size="25" /></td>
				  <th align="left" >质量控制卡(指导书)：</th>
				  <td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_GZRWD_ZLKZK','0')" alt="打开附件列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传质量控制卡</font>
						</c:if>
					</td>
				  </tr>
				  <tr>
				  <th align="left" >风险辨识控制卡:</th>
				<td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_GZRWD_FXKZK','0')" alt="打开附件列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传风险辨识控制卡</font>
						</c:if>
					</td>
				  <th align="left">作业控制卡：</th>
				 <td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_GZRWD_ZYKZK','0')" alt="打开附件列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传作业控制卡</font>
						</c:if>
					</td>
   				</tr>
				<tr>
					<th align="left" >调试报告：</th>
					<td>
						<c:if test="${entity.id != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${entity.id}','TAB_GZRWD_TSBG','0')" alt="打开附件列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${entity.id == '0'}">
							&nbsp;<img src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传录音</font>
						</c:if>
					</td>
					<th align="left" >台账记录：</th>
					<td >
						<s:textfield   name="entity.tzjlno2" maxlength="50" size="25" /></td></tr>
						
							<tr>
					<th align="left" >同车班组：</th>
					<td >
						
							<input type="text"  readonly="true" style="width:90%" name="entity.tcbz" value="${entity.tcbz}" msg="同车班组必须输入。">
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getBz('entity.gzr','entity.tcbz','entity.ouid')" />
					
							</td>
				</tr>
				<tr>
					<th rowspan="2">
						派车人确认
					</th>
					<td>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;派车时间：
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.pcsj')})" size="16" readonly="true" name="entity.pcsj" value='<fmt:formatDate value="${entity.pcsj}" pattern="yyyy-MM-dd HH:mm"/>' />
						<img onclick="WdatePicker({el:$dp.$('entity.pcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<td >
						&nbsp;<font color="red">*</font>&nbsp;车型车号：
						<input type="text" style="width:50%"  maxlength="25" name="entity.cxch" value="${entity.cxch}" msg="车型车号必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getCydy('CXCH','entity.cxch')" />
					</td>
					<td>
						总行驶里程：
						<input type="text" style="width:50%;text-align:right" datatype= "Custom" regexp="((^[1-9]{1}\d{0,7}$)|(^0$)|(^0\.\d{1,2}$)|(^([1-9]{1}\d{0,7}){1,1}(\.){1,1}(\d{1,2}){1,1}$))" maxlength="11" require="false" name="entity.zxslc" value="${entity.zxslc}" msg="总行驶里程最多输入8位整数2位小数" />
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;还车时间：
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.hcsj')})" size="16" readonly="true" name="entity.hcsj" value='<fmt:formatDate value="${entity.hcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="日期必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.hcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<td >
						驾驶员签字：
						<input type="text" style="width:50%" name="entity.jsyqz"  maxlength="25" value="${entity.jsyqz}" />
					</td>
					<td>
						派车人签字：
						<input type="text" style="width:50%" name="entity.pcrqz"  maxlength="25" value="${entity.pcrqz}" />
					</td>
				</tr>
				<tr>
					<th>
						乘车人确认
					</th>
					<td>
						实际发车时间：
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.sjfcsj')})" size="16" readonly="true" name="entity.sjfcsj" value='<fmt:formatDate value="${entity.sjfcsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="日期必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.sjfcsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<td >
						&nbsp;&nbsp;&nbsp;&nbsp;起始表码：
						<input type="text" style="width:50%;text-align:right"datatype= "Custom" regexp="((^[1-9]{1}\d{0,7}$)|(^0$)|(^0\.\d{1,2}$)|(^([1-9]{1}\d{0,7}){1,1}(\.){1,1}(\d{1,2}){1,1}$))" maxlength="11" require="false"  name="entity.qsbm" value="${entity.qsbm}" msg="起始表码最多输入8位整数2位小数。" maxlength="11"/>
					</td>
					<td>
						驾驶员签字：
						<input type="text" style="width:50%;"  maxlength="25" name="entity.jsyqz2" value="${entity.jsyqz2}"/>
					</td>
				</tr>
				<tr>
					<th align="left" >备注：</th>
					<td colspan="3" >
						<textarea name="entity.remark" style="width:99%; height: 30px; min-height: 20px;line-height:15pt" min="0" datatype="LimitB"  min="1"   max="2000"    msg="" >${entity.remark}</textarea></td>
				</tr>
				<% if ("0".equals(session.getAttribute("SESSION_ISADMIN"))) {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr" value="${entity.cjr}" msg="录入人员必须输入。"/>
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" name="entity.cjsj" readonly="true" value='<fmt:formatDate value="${entity.cjsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="巡视结束时间必须输入。"/>
					</td>
				</tr>
				<%} else {%>
				<tr>
					<th width="120" nowrap>
						录入人员：
					</th>
					<td>
						<s:hidden name="entity.cjrid"/>
						<input type="text" style="width:50%" readonly="true" name="entity.cjr" value="${entity.cjr}" msg="录入人员必须输入。"/>
						<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('entity.cjrid','entity.cjr','entity.bdz')" />
					</td>
					<th width="120" nowrap>
						录入时间：
					</th>
					<td>
						<input type="text" onclick="WdatePicker({el:$dp.$('entity.cjsj')})" name="entity.cjsj" readonly="true" value='<fmt:formatDate value="${entity.cjsj}" pattern="yyyy-MM-dd HH:mm"/>' msg="巡视结束时间必须输入。"/>
						<img onclick="WdatePicker({el:$dp.$('entity.cjsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<%}%>
			</table>
		</form>
		
		</div>
	</body>
</html>
<script language="javascript">

	String.prototype.startWith=function(str){
		if(str==null||str==""||this.length==0||str.length>this.length)
			return false;
		if(this.substr(0,str.length)==str)
			return true;
		else
			return false;
		return true;
	}
	

	 // 保存
     function comt(){
     	document.getElementById("entity.zbzname").value = document.getElementById("entity.zbz").options[document.getElementById("entity.zbz").selectedIndex].text;
     	document.frmM.action = "<%=contextPath%>/gzrwd!save.do";
     	document.frmM.submit();
     }
      // 归档
     function comthistory(){
     	document.getElementById("entity.zbzname").value = document.getElementById("entity.zbz").options[document.getElementById("entity.zbz").selectedIndex].text;
     	document.frmM.action = "<%=contextPath%>/gzrwd!history.do";
     	document.frmM.submit();
     }
     // 通过任务单保存
     function saveRwd(ids) {
     	document.getElementById("entity.zbzname").value = document.getElementById("entity.zbz").options[document.getElementById("entity.zbz").selectedIndex].text;
     	document.getElementById("ids").value = ids;
        document.frmM.action = "<%=contextPath%>/gzrwd!saveRwd.do";
     	document.frmM.submit();
     }
     
     // 任务单选择是否时修改
     function updateRw(sfwc,czid,url,id) {
     
     	if (sfwc.options[sfwc.selectedIndex].value == "1") {
     	
     		var url2 = "<%=contextPath%>/" + url + "!initDetail.do?id=" + czid + "&gzrwdRwid=" + id + "&gzrwdry=" + document.getElementById("entity.zby").value;
     		
     		//url2 = encodeURI(url2);
			var win = window.open(url2,"Result_window2","left=50,top=30,width=1000,height=600,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=no",true);
		
		} else if (sfwc.options[sfwc.selectedIndex].value == "0") {
		
			Ext.MessageBox.show({   
                title:'工作任务未完成原因',   
                msg:'',   
                width:300,   
                buttons:Ext.MessageBox.OKCANCEL,   
                multiline:true,   
                fn:function(btn,text){   
                    
                    if (btn == "ok") {
                    
                    	var yc = "";
                    	if (document.getElementById("entity.ycclqk").value == "") {
                    		yc = text;
                    	} else {
                    		yc = document.getElementById("entity.ycclqk").value + "\n" + text;
                    	}
                    
						Ext.Ajax.request({
							method :'POST',
							url : "<%=contextPath%>/gzrwd!updateRw.do?id=" + id,
							params:{ycclqk:yc},
							success : function(response) {
								document.getElementById("entity.ycclqk").value = yc;
        						Ext.MessageBox.alert('提示','任务单已经取消');

							},
							failure : function() {
								alert("异步失败！");
								return false;
							}
						});
                    
                    } else {
                    	sfwc.options.selectedIndex = "0";
                    }
                    
                }   
            });   
            /*
            if (confirm("选定的任务确实没有完成吗？")) {
			
				var str = "";
				if (url == 'xsqk' && id == '0') {
					str = '&xslx=2'
				}
		
				Ext.Ajax.request({
					method :'POST',
					url : "<%=contextPath%>/gzrwd!updateRw.do?id=" + id + str,
					success : function(response) {
        				alert("任务单已经取消");

					},
					failure : function() {
						alert("异步失败！");
							return false;
					}
				});
			
			} else {
				sfwc.options.selectedIndex = "0";
			}
		*/
	
		}
     
     }
     
     // 风险点告知
     function fxdgz() {
		
		<c:if test="${GZRWDLIST == null || fn:length(GZRWDLIST) == 0 }">
			alert("请先添加工作任务");
			return;
		</c:if>
		
    	var t = document.getElementById("TGzrwdFxgz");
    		
    	var idsalready = "";
    		
       	for (var i=0;i<t.childNodes.length;i++) {
       		idsalready += "," + t.childNodes[i].childNodes[0].innerHTML;
       	}

		if (idsalready.startWith(",")) {
			idsalready = idsalready.substring(1,idsalready.length);
		}
		
		document.getElementById("idsalready").value = idsalready;

 		var url = "<%=contextPath%>/jsp/popup/fxgzCheckBox.jsp?";
 		window.open(url,"变电检修工区工作任务单","left=500,top=30,width=320,height=600,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=no",true);
		//var win = openSUB(url,2,500,600,500,30);
     
     }
     
     // 任务风险告知保存
     function saveFxgz(ids) {
     	document.getElementById("entity.zbzname").value =  document.getElementById("entity.zbz").options[document.getElementById("entity.zbz").options.selectedIndex].text;
     	document.getElementById("ids").value = ids;
        document.frmM.action = "<%=contextPath%>/gzrwd!saveFxgz.do";
     	document.frmM.submit();
     }
     // 任务风险告知修改
     function updateFxgz(ids,fxgznr) {
     	document.getElementById("entity.zbzname").value =  document.getElementById("entity.zbz").options[document.getElementById("entity.zbz").options.selectedIndex].text;
     	document.getElementById("ids").value = ids;
     	//window.alert(ids+"----"+fxgznr);
     	//window.alert(document.getElementById(fxgznr).value);
     	document.getElementById('fxgznr').value = document.getElementById(fxgznr).value;
        document.frmM.action = "<%=contextPath%>/gzrwd!updateFxgz.do";
     	document.frmM.submit();
     }
	// 删除文件
    function deleteDetail(id,model,trid){
    
    	var msg = "确定要删除吗？";

		if (trid.startWith("gzrw")) {
			msg = "确定要取消工作任务吗？";
		}    
    	if (confirm(msg)) {
    	
				Ext.Ajax.request( {
					method :'POST',
					url :'gzrwd!deleteDetail.do?id='+ id+"&model=" + model,
					success : function(response) {
        				var mytable = document.getElementById(model);  
        				var myrow = document.getElementById(trid);   
       				    mytable.deleteRow(myrow.rowIndex-1);  
       				    
       				    Ext.MessageBox.alert('提示','取消成功');
						
					},
					failure : function() {
						Ext.MessageBox.alert('提示','取消失败');
					}
				});
		}
    }
     
     // 返回
     function back() {
     	document.frmM.action = "<%=contextPath%>/gzrwdList!getList.do?planid=" + document.getElementById("entity.planid").value;
		document.frmM.submit();
     }
     
     // 打印
     function print() {
     	
     	if (document.getElementById("entity.id").value == "0") {
     		alert("请先保存信息");
     		return;
     	}
 		var url = "<%=contextPath%>/gzrwd!print.do?id=" + document.getElementById("entity.id").value;
 		//window.open(url,"变电运行工区工作任务单","left=50,top=30,width=1000,height=600,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=no",true);
		var win = openSUB(url,2,800,600,50,30);
     }
  // 待办任务单删除
     function deleteRwd(ids) {
     	document.getElementById("entity.zbzname").value = document.getElementById("entity.zbz").options[document.getElementById("entity.zbz").selectedIndex].text;
     	document.getElementById("ids").value = ids;
        document.frmM.action = "<%=contextPath%>/gzrwd!deleteRwd.do";
     	document.frmM.submit();
     }
     
</script>